<!DOCTYPE html>
<html>
    <head>
        <meta name="layout" content="main" />
        <g:set var="entityName" value="${message(code: 'loginHistory.label', default: 'LoginHistory')}" />
        <title>客户调查报告</title>
        <asset:stylesheet src="styles/css/analy.css" />
        <style>
            .sub_title{
                white-space: nowrap;
                text-overflow: ellipsis;
                overflow: hidden;
            }
        </style>
    </head>
    <body>
        %{--header--}%
        <div class="small-header">
            <div class="hpanel">
                <div class="panel-body">
                    <div id="hbreadcrumb" class="pull-right">
                        <ol class="hbreadcrumb breadcrumb">
                            <li>CINDATA PLS</li>
                            <li class="active">
                                <span>客户信息</span>
                            </li>
                        </ol>
                    </div>

                    <h2 class="font-light m-b-xs">
                        客户调查报告
                    </h2>
                </div>
            </div>
        </div>
        %{--content--}%
        <div class="content animate-panel">
            <div class="row">
                <g:form method="POST" action="customerSurveyReport" class="form-horizontal">
                    <div class="hpanel hblue">
                        <div class="panel-heading">
                            <div class="panel-tools">
                                <button class="btn btn-primary btn-xs" type="submit" onclick="text()"><i class="fa fa-search"></i> 查询</button>
                                <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                                    <i class="fa fa-times"></i> 重置</button>
                            </div>
                            查询
                        </div>
                        <div class="panel-body seach-group" id="bug1">
                            <div class="row">
                                <div class="form-group col-sm-4">
                                    <label class="col-sm-3 control-label">主借款人</label>
                                    <div class="col-sm-9">
                                        <input type="text" class="form-control" name="fullName" id="fullName" value="${params?.fullName}" placeholder="请输入主借款人姓名">
                                    </div>
                                </div>
                                <div class="form-group col-sm-4">
                                    <label class="col-sm-3 control-label">状态</label>
                                    <div class="col-sm-9 input-group" style="display: flex;justify-content: center">
                                        <!-- <g:select class="form-control" name="status" id="status" from="['待复核','已复核','已完结']" value="${params?.status}" noSelection="${['': '全部']}"/> -->
                                        <g:select class="form-control" name="stage" id="stage" from="${com.cindata.ContactSurveyReport.constrainedProperties.stage.inList}" value="${params?.stage}" noSelection="${['': '全部']}"/>
                                    </div>
                                </div>
                                <div class="form-group col-sm-4">
                                    <label class="col-sm-3 control-label">身份证号</label>
                                    <div class="col-sm-9">
                                        <input type="text" class="form-control" name="idNumber" id="idNumber" value="${params?.idNumber}" placeholder="请输入身份证号">
                                    </div>
                                </div>
                              </div>
                              <div class="row">
                                <div class="form-group col-sm-4">
                                    <label class="col-sm-3 control-label">移动电话</label>
                                    <div class="col-sm-9">
                                        <input type="text" class="form-control" name="cellphone" id="cellphone" value="${params?.cellphone}" placeholder="请输入手机号">
                                    </div>
                                </div>
                                <div class="form-group col-sm-4">
                                    <label class="col-sm-3 control-label">录入时间</label>
                                    <div class="col-sm-9 input-daterange input-group p-r-n"  id="datepicker" style="width: 75%;">
                                        <input type="text" class=" form-control " placeholder="录入起始时间"
                                               value="${params?.startDate}" name="startDate" id="startDate" style="text-align: left" />
                                        <span class="input-group-addon">至</span>
                                        <input type="text" class=" form-control " placeholder="录入截止时间"
                                               value="${params?.endDate}" name="endDate" id="endDate" style="text-align: left" />
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </g:form>
            </div>

            <div class="row">
                <div class="hpanel hgreen">
                    <div class="panel-heading">
                        <div class="panel-tools">
                            <g:link action="createClient" class="btn btn-info btn-xs" controller="contact"><i class="fa fa-plus"></i>新增客户</g:link>
                        </div>
                        客户列表
                    </div>

                    <div class="panel-body no-padding">
                        <div class="table-responsive">
                            <table cellpadding="1" cellspacing="1" class="table table-striped table-bordered table-hover text-center" id="esateTable">
                                <thead>
                                <tr>
                                    <g:sortableColumn property="id" title="序号" class="text-center" />
                                    <g:sortableColumn property="id" title="业务流水号" class="text-center" />
                                    <g:sortableColumn property="id" title="录入日期" class="text-center" />
                                    <g:sortableColumn property="id" title="经办人" class="text-center" />
                                    <g:sortableColumn property="id" title="复核人" class="text-center" />
                                    <g:sortableColumn property="id" title="状态" class="text-center" />
                                    <g:sortableColumn property="id" title="贷款金额（元）" class="text-center" />
                                    <g:sortableColumn property="id" title="主借款人" class="text-center" />
                                    <g:sortableColumn property="id" title="身份证号" class="text-center" />
                                    <g:sortableColumn property="id" title="移动电话" class="text-center" />
                                    <g:sortableColumn property="id" title="性别" class="text-center" />
                                    <th style="color: #34495e;" colspan="2">操作项</th>
                                </tr>
                                </thead>
                                <tbody>
                                  <g:each in="${list}">
                                  <tr>
                                      <td><g:link action="customerShow" id="${it?.id}">${it?.id}</g:link></td>
                                      <td>${it?.serialNumber}</td>
                                      <td>${it?.createdDate}</td>
                                      <td>${it?.createBy?.fullName}</td>
                                      <td>${it?.modifyBy?.fullName}</td>
                                      <td>${it?.stage}</td>
                                      <td>${it?.loansAmount}</td>
                                      <td>${it?.contact?.fullName}</td>
                                      <td>${it?.contact?.idNumber}</td>
                                      <td>${it?.contact?.cellphone}</td>
                                      <td>${it?.contact?.sex}</td>
                                      <td class="text-center">
                                        <div class="btn btn-xs btn-outline btn-success <g:if test="${it?.stage == '已申请'}"> handleButton </g:if>" href="${it?.id}" style="width: 52px; margin-top: 2px;">复核</div>
                                      </td>
                                      <td class="text-center">
                                        <div class="btn btn-xs btn-outline btn-danger deleteButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">删除</div>
                                      </td>
                                  </tr>
                                </g:each>
                                    <!-- <tr>
                                        <td>1</td>
                                        <td>DC201711020001</td>
                                        <td>2017-11-02 11:26:27</td>
                                        <td>于蔷薇</td>
                                        <td>于蔷薇</td>
                                        <td>已复核</td>
                                        <td>800000</td>
                                        <td>于哈哈</td>
                                        <td>220221</td>
                                        <td>15200000987</td>
                                        <td>女</td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-success handleButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">复核</div>
                                        </td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-danger deleteButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">删除</div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>2</td>
                                        <td>DC201709270002</td>
                                        <td>2017-11-02 11:32:25</td>
                                        <td>超级管理员</td>
                                        <td>超级管理员</td>
                                        <td>已复核</td>
                                        <td>10000</td>
                                        <td>刘德华</td>
                                        <td>1312</td>
                                        <td>18900000002</td>
                                        <td>女</td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-success handleButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">复核</div>
                                        </td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-danger deleteButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">删除</div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>3</td>
                                        <td>DC201709270001</td>
                                        <td>2017-09-27 08:45:25</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>待复核</td>
                                        <td>10000</td>
                                        <td>刘德华</td>
                                        <td>12345</td>
                                        <td>18900000002</td>
                                        <td>女</td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-success handleButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">复核</div>
                                        </td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-danger deleteButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">删除</div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>4</td>
                                        <td>DC201709260001</td>
                                        <td>2017-11-02 11:31:56</td>
                                        <td>超级管理员</td>
                                        <td>-</td>
                                        <td>待复核</td>
                                        <td>10000</td>
                                        <td>111</td>
                                        <td>111</td>
                                        <td>18900000002</td>
                                        <td>男</td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-success handleButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">复核</div>
                                        </td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-danger deleteButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">删除</div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>5</td>
                                        <td>DC201709250001</td>
                                        <td>2017-09-25 17:50:51</td>
                                        <td>mengxw</td>
                                        <td>mengxw</td>
                                        <td>已完结</td>
                                        <td>2</td>
                                        <td>用户3</td>
                                        <td>1312</td>
                                        <td>18900000002</td>
                                        <td>男</td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-success handleButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">复核</div>
                                        </td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-danger deleteButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">删除</div>
                                        </td>
                                    </tr>
                                    <tr>
                                        <td>6</td>
                                        <td>DC201708300002</td>
                                        <td>2017-08-30 18:15:37</td>
                                        <td>王建宇</td>
                                        <td>王建宇</td>
                                        <td>已复核</td>
                                        <td>400000</td>
                                        <td>用户1</td>
                                        <td>125的</td>
                                        <td>11111111111</td>
                                        <td>男</td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-success handleButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">复核</div>
                                        </td>
                                        <td class="text-center">
                                          <div class="btn btn-xs btn-outline btn-danger deleteButton" href="${it?.id}" style="width: 52px; margin-top: 2px;">删除</div>
                                        </td>
                                    </tr> -->
                                </tbody>
                            </table>
                        </div>
                    </div>

                    <div class="panel-footer">
                        <div class="pagination">
                            <g:paginate action="index" total="${count ?: 0}" params="${params}"/>
                        </div>

                    </div>
                </div>
            </div>
        </div>
        <g:javascript>
        $(".handleButton").click(function(event){
            event.preventDefault();
            var id = $(this).attr("href");
            swal({
                    title: "确定要复核吗",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    closeOnConfirm: true
                },
                function(){
                    $.ajax({
                        url:'/contact/reviewContactSurvey',
                        data:{
                            id:id
                        },
                        type:"post",
                        success:function(data)
                        {
                            if(data.status=="success"){
                                window.location.href="/contact/customerSurveyReport"
                            }else{
                                swal("复核失败，请稍后重试", "", "error");
                            }
                        }
                    })

                });
        });

        $(".deleteButton").click(function(event){
            event.preventDefault();
            var id = $(this).attr("href");
            swal({
                    title: "是否确认删除",
                    type: "warning",
                    showCancelButton: true,
                    confirmButtonColor: "#DD6B55",
                    confirmButtonText: "确定",
                    cancelButtonText: "取消",
                    closeOnConfirm: true
                },
                function(){
                    $.ajax({
                        url:'/contact/deleteContactSurvey',
                        data:{
                            id:id
                        },
                        type:"post",
                        success:function(data)
                        {
                            if(data.status=="success"){
                                window.location.href="/contact/customerSurveyReport"
                            }else{
                                swal("删除失败，请稍后重试", "", "error");
                            }
                        }
                    })

                });
        });

        //重置按钮
        $("#resetBtn").click(function () {
            $("#fullName").val("");
            $("#s2id_stage span:first").html("全部");
            $("#stage").val("");
            $("#idNumber").val("");
            $("#cellphone").val("");
            $("#startDate").val("");
            $("#endDate").val("");

        });
        </g:javascript>
    </body>
</html>
